package com.clj.fastble.data;

import ohos.bluetooth.BluetoothRemoteDevice;
import ohos.bluetooth.ble.BlePeripheralDevice;
import ohos.utils.Parcel;
import ohos.utils.Sequenceable;

import java.io.Serializable;

/**
 * BleDevice
 */
public class BleDevice implements Sequenceable {
    private BlePeripheralDevice mBleDevice;
    private byte[] manufacturerData;
    private String manufacturer;
    private int mRssi;
    private long mTimestampNanos;

    // 是否可连接
    private boolean isConnectable;
    private String connectState = "可连接";
    private int AdvertiseFlag;
    private String address;

    public BleDevice() {}

    public BleDevice(BlePeripheralDevice device) {
        mBleDevice = device;
    }

    public BleDevice(
            BlePeripheralDevice device,
            int rssi,
            byte[] manufacturerData,
            String manufacturer,
            long timestampNanos,
            boolean isConnect,
            int AdvertiseFlag) {
        mBleDevice = device;
        this.manufacturerData = manufacturerData;
        mRssi = rssi;
        mTimestampNanos = timestampNanos;
        this.isConnectable = isConnect;
        this.AdvertiseFlag = AdvertiseFlag;
        this.manufacturer = manufacturer;
        this.address = manufacturer;
    }

    /**
     * getBleDevice
     * @return BlePeripheralDevice
     */
    public BlePeripheralDevice getBleDevice() {
        return mBleDevice;
    }

    /**
     * setBleDevice
     * @param mBleDevice mBleDevice
     */
    public void setBleDevice(BlePeripheralDevice mBleDevice) {
        this.mBleDevice = mBleDevice;
    }

    /**
     * 地址码
     * @return String
     */
    public String getAddress() {
        return address;
    }

    /**
     * setAddress
     * @param address address
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * getName
     * @return String
     */
    public String getName() {
        if (mBleDevice != null) {
            return "name";
        }
        return null;
    }

    /**
     * getMac
     * @return String
     */
    public String getMac() {
        if (mBleDevice != null) {
            return "mac";
        }
        return null;
    }

    /**
     * getManufacturerData
     * @return byte
     */
    public byte[] getManufacturerData() {
        return manufacturerData;
    }

    /**
     * setManufacturerData
     * @param manufacturerData manufacturerData
     */
    public void setManufacturerData(byte[] manufacturerData) {
        this.manufacturerData = manufacturerData;
    }

    /**
     * getManufacturer
     * @return String
     */
    public String getManufacturer() {
        return manufacturer;
    }

    /**
     * getConnectState
     * @return String
     */
    public String getConnectState() {
        return connectState;
    }

    /**
     * setConnectState
     * @param connectState connectState
     */
    public void setConnectState(String connectState) {
        this.connectState = connectState;
    }

    /**
     * setManufacturer
     * @param manufacturer manufacturer
     */
    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }

    /**
     * isConnectable
     * @return boolean
     */
    public boolean isConnectable() {
        return isConnectable;
    }

    /**
     * setConnectable
     * @param connectable connectable
     */
    public void setConnectable(boolean connectable) {
        isConnectable = connectable;
    }

    /**
     * getAdvertiseFlag
     * @return int
     */
    public int getAdvertiseFlag() {
        return AdvertiseFlag;
    }

    /**
     * setAdvertiseFlag
     * @param advertiseFlag advertiseFlag
     */
    public void setAdvertiseFlag(int advertiseFlag) {
        AdvertiseFlag = advertiseFlag;
    }

    /**
     * getKey
     * @return String
     */
    public String getKey() {
        return "key";
    }

    /**
     * getDevice
     * @return BlePeripheralDevice
     */
    public BlePeripheralDevice getDevice() {
        return mBleDevice;
    }

    /**
     * getRssi
     * @return int
     */
    public int getRssi() {
        return mRssi;
    }

    /**
     * setRssi
     * @param rssi rssi
     */
    public void setRssi(int rssi) {
        this.mRssi = rssi;
    }

    /**
     * getTimestampNanos
     * @return long
     */
    public long getTimestampNanos() {
        return mTimestampNanos;
    }

    /**
     * setTimestampNanos
     * @param timestampNanos timestampNanos
     */
    public void setTimestampNanos(long timestampNanos) {
        this.mTimestampNanos = timestampNanos;
    }

    @Override
    public boolean hasFileDescriptor() {
        return false;
    }

    @Override
    public boolean marshalling(Parcel parcel) {
        return false;
    }

    @Override
    public boolean unmarshalling(Parcel parcel) {
        return false;
    }
}
